import React, { Component } from 'react';
import { View, Text, StyleSheet, PixelRatio, Image, TouchableOpacity, Alert, ScrollView } from 'react-native';
import { style } from '../../../theme/style';
import { GLOBAL } from '../../../config/global';
import MethodUtil from '../../../utils/MethodUtil';
import Utils from '../../../utils/utils';
import ConstData from '../../../utils/constData';
import { PageStatusIndex } from '../../../component/page-status/PageStatusIndex';
const scale = GLOBAL.SCALE;

export class BodyCpt extends Component {
	constructor(props) {
		super(props);
		this.state = {
			modalVisible: false
		}
	}

	async componentWillMount() {
		let Const = await ConstData.get();
		if (Const) {
			this.constProportion = Const.ORDER_PRICE_FEE_RATE;
			this.setState({
				ls: true
			})
		}
	}


	//关闭弹框
	_closeFn = () => {
		this.setState({ isVisible: false })
	}


	//累加
	_addFn = (...agrs) => {
		let result = 0;
		agrs.forEach(item => {
			item = item || 0;
			result = MethodUtil.countObj.add(result, item);
		})
		return result;
	}


	//
	_alertFn = () => {
		let { data } = this.props || {};
		let { orderFlag } = data || {};
		let { tCode, orderType, bidId } = orderFlag;
		let iconText = '';

		if (bidId) { //转单
			if (orderType == 'P') {
				iconText = '落袋价=（（采购壹化网单价+额外运费单价）+ 授信资金成本单价  + 运费成本单价+ 杂费成本平均单价）*数量';
			} else if (orderType == 'S') {
				iconText = '落袋价=（（壹化网单价+额外运费+销售授信资金收入单价+销售票据资金收入单价-客户优惠）-（授信资金成本单价+票据资金成本单价+运费成本单价+杂费成本平均单价）*数量';
			}
		} else if ((tCode == 'S' || tCode == 'E') && orderType == 'P') {  //采(现货/长约)
			iconText = '落袋价=（采购成本单价+资金授信成本单价+运费成本单价+杂费成本平均单价）*数量';
		} else if ((tCode == 'S' || tCode == 'E') && orderType == 'S') { //销(现货/长约)
			iconText = '落袋价=（(销售单价 - 客户优惠) -（授信资金成本单价+票据资金成本单价+运费成本单价+杂费成本平均单价））*数量';
		} else if (tCode == 'QH') {// 泉化
			iconText = '落袋价=（（销售单价+额外运费+升贴水-客户优惠）-（授信资金成本单价+票据资金成本单价+运费成本））*数量';
		}


		Alert.alert('提示', iconText, [
			{
				text: '知道了',
			}
		])
	}


	// 订单关联
	_relation = () => {
		let { data } = this.props || {};
		let { priceData, orderFlag, detailsDataAll } = data || {};
		console.log('detailsDataAll', detailsDataAll)
		let { fundCreditFee, fundVoucherFee, yunfei, averageOtherCost, pocketPrice, average, expect, lockedQuantity, groupName, expectALl,
			totalQuantity, price, priceType, orderPriceItemList, index } = detailsDataAll || {};
		let { orderType, tCode } = orderFlag || {};
		let tatol = MethodUtil.countObj.multiply(totalQuantity, price, 2);
		let { purchaseOrderItem } = orderPriceItemList[index] || {};
		return (
			<View>
				{
					orderType == 'S' ? (<View style={styles.infoBox}>
						<View style={styles.infoRow}>
							<Text style={styles.infoText}>* 采购成本单价=该商品所关联的采购成交均价</Text>
						</View>
						<View style={styles.infoRow}>
							<Text style={styles.infoText}>* 杂费成本单价=本单杂费平均单价</Text>
						</View>
					</View>) : (
							<View style={styles.infoBox}>
								<View style={styles.infoRow}>
									<Text style={styles.infoText}>* 销售单价=该商品所关联的销售成交均价</Text>
								</View>
								<View style={styles.infoRow}>
									<Text style={styles.infoText}>* 杂费单价=本单杂费平均单价</Text>
								</View>
							</View>
						)
				}

				<View style={styles.list}>
					<View style={styles.rPadding}>
						<Text style={styles.rGoodsName}>{groupName || '-'}</Text>
					</View>
					<View style={styles.rBox}>
						<View style={[styles.rPadding, styles.xian]}>
							<View style={[styles.rRow, { padding: 0 }]}>
								<Text style={styles.rGoodsName}>成本收益（元/吨）</Text>
							</View>
							<View style={styles.rRow}>
								<Text style={styles.rFlex4}></Text>
								<Text style={[styles.rFlex3, styles.rKey]}>{orderType == 'P' ? '成本' : '销售'}</Text>
								<Text style={[styles.rFlex2, styles.rKey]}>{orderType == 'P' ? '关联销售' : '成本'}</Text>
							</View>

							<View style={styles.rRow}>
								<Text style={[styles.rFlex4, styles.rKey]}>单价</Text>
								<View style={[styles.rRowActive, styles.rFlex3]}>
									<Text style={[styles.rValue, styles.rBold]}>{(tCode == 'C' && orderType == 'P') ? purchaseOrderItem.price : price}</Text>
									<Text style={[styles.rRed, styles.fontSize10]}>（合同）</Text>
								</View>
								<View style={[styles.rFlex2, styles.rRowActive]}>
									<Text style={[styles.rValue, styles.rBold]}>{lockedQuantity ? average : '-'}</Text>
									{/* {priceType == "2" ? (quantity ? <Text style={styles.goodsType}>暂定价</Text> : null) : (lockedQuantity ? <Text style={styles.goodsTypeActive}>一口价</Text> : null)} */}
									<Text style={styles.goodsType}>暂定价</Text>
								</View>
							</View>


							<View style={styles.rRow}>
								<Text style={[styles.rFlex4, styles.rKey]}>运费</Text>
								<Text style={[styles.rFlex3, styles.rValue, styles.rBold]}>{orderType == 'P' ? (yunfei || '-') : '-'}</Text>
								<Text style={[styles.rFlex2, styles.rValue, styles.rBold]}>{orderType == 'S' ? (yunfei || '-') : '-'}</Text>
							</View>



							{
								tCode == 'C' ? (<View style={styles.rRow}>
									<Text style={[styles.rFlex4, styles.rKey]}>资金（授信）</Text>
									<Text style={[styles.rFlex3, styles.rValue, styles.rBold]}>{orderType == 'P' ? (MethodUtil.countObj.add(purchaseOrderItem.fundCreditFee, fundCreditFee) || '-') : '-'}</Text>
									<Text style={[styles.rFlex2, styles.rValue, styles.rBold]}>{orderType == 'S' ? (fundCreditFee || '-') : '-'}</Text>
								</View>) : (
										<View style={styles.rRow}>
											<Text style={[styles.rFlex4, styles.rKey]}>资金（授信）</Text>
											<Text style={[styles.rFlex3, styles.rValue, styles.rBold]}>{orderType == 'P' ? (fundCreditFee || '-') : '-'}</Text>
											<Text style={[styles.rFlex2, styles.rValue, styles.rBold]}>{orderType == 'S' ? (fundCreditFee || '-') : '-'}</Text>
										</View>
									)
							}

							{
								tCode == 'C' ? (<View style={styles.rRow}>
									<Text style={[styles.rFlex4, styles.rKey]}>资金（票据）</Text>
									<Text style={[styles.rFlex3, styles.rValue, styles.rBold]}>{MethodUtil.countObj.add(purchaseOrderItem.fundVoucherFee || 0, fundVoucherFee || 0) || '-'}</Text>
									<Text style={[styles.rFlex2, styles.rValue, styles.rBold]}>{orderType == 'S' ? (fundVoucherFee || '-') : '-'}</Text>
								</View>) : (<View style={styles.rRow}>
									<Text style={[styles.rFlex4, styles.rKey]}>资金（票据）</Text>
									<Text style={[styles.rFlex3, styles.rValue, styles.rBold]}>{orderType == 'P' ? (fundVoucherFee || '-') : '-'}</Text>
									<Text style={[styles.rFlex2, styles.rValue, styles.rBold]}>{orderType == 'S' ? (fundVoucherFee || '-') : '-'}</Text>
								</View>)
							}



							<View style={styles.rRow}>
								<Text style={[styles.rFlex4, styles.rKey]}>杂费</Text>
								<Text style={[styles.rFlex3, styles.rValue, styles.rBold]}>{orderType == 'P' ? (averageOtherCost || '-') : '-'}</Text>
								<Text style={[styles.rFlex2, styles.rValue, styles.rBold]}>{orderType == 'S' ? (averageOtherCost || '-') : '-'}</Text>
							</View>

						</View>
						<View style={styles.rPadding}>
							{
								orderType == 'P' ? (<View style={styles.rRow}>
									<Text style={[styles.rFlex4, styles.rKey, styles.rBold]}>合计</Text>
									<Text style={[styles.rFlex3, styles.rValue, styles.rBold]}>{pocketPrice || '-'}<Text style={[styles.rRed, styles.fontSize10]}>（落袋）</Text></Text>
									<Text style={[styles.rFlex2, styles.rValue, styles.rBold]}>{average || '-'}</Text>
								</View>) : (
										<View style={styles.rRow}>
											<Text style={[styles.rFlex4, styles.rKey, styles.rBold]}>合计</Text>
											<Text style={[styles.rFlex3, styles.rValue, styles.rBold]}>{price || '-'}<Text style={[styles.rRed, styles.fontSize10]}>（合同）</Text></Text>
											<Text style={[styles.rFlex2, styles.rValue, styles.rBold]}>{this._addFn(average, yunfei, fundCreditFee, fundVoucherFee, averageOtherCost) || '-'}</Text>
										</View>
									)
							}
							<View style={styles.rRow}>
								<Text style={[styles.rFlex7, styles.rKey, styles.rRight]}>落袋价：</Text>
								<Text style={[styles.rFlex2, styles.rValue]}><Text style={styles.rBold}>{pocketPrice || '-'}</Text> 元/吨 </Text>
							</View>
							<View style={styles.rRow}>
								<Text style={[styles.rFlex7, styles.rKey, styles.rRight]}>预计毛利：</Text>
								<Text style={[styles.rFlex2, styles.rValue]}><Text style={styles.rBold}>{lockedQuantity ? (expect || '-') : '-'}</Text> 元/吨 </Text>
							</View>
							<View style={styles.rRow}>
								<Text style={[styles.rFlex7, styles.rKey, styles.rRight]}>数量：<Text style={styles.rBold}>{totalQuantity || '-'}</Text> 吨，商品总额：</Text>
								<Text style={[styles.rFlex2, styles.rValue]}><Text style={styles.rBold}>{tatol || '-'}</Text> 元 </Text>
							</View>
							<View style={styles.rRow}>
								<Text style={[styles.rFlex7, styles.rKey, styles.rRight]}>关联数量：<Text style={styles.rBold}>{lockedQuantity || '-'}</Text> 吨，<Text style={styles.rRed}>预计总毛利：</Text></Text>
								<Text style={[styles.rFlex2, styles.rValue, styles.rRed]}><Text style={[styles.rBold, styles.rRed]}>{(expectALl || 0).toFixed(2) || '-'}</Text> 元</Text>
							</View>
						</View>

					</View>
				</View>
			</View>
		)
	}

	//闭口
	_renderC = () => {
		let { data } = this.props || {};
		let { priceData, orderFlag } = data || {};
		let { orderPriceItemList, orderPriceInfo } = priceData || {};
		let { logisticsFee, averageOtherCost } = orderPriceInfo || {};
		console.log('data-闭口', data)
		return (
			<View>
				<View style={styles.infoBox}>
					<View style={styles.infoRow}>
						<Text style={styles.infoNum}>1.</Text>
						<Text style={styles.infoText}>计算毛利单价时，授信、票据、运费、杂费成本单价计算其内</Text>
					</View>
					<View style={styles.infoRow}>
						<Text style={[styles.infoNum, { opacity: 0 }]}>1.</Text>
						<Text style={styles.infoText}>暂定价=销售升贴水-（采购升贴水+授信成本单价+票据成本单价+运费成本单价+杂费平均单价）</Text>
					</View>
					<View style={styles.infoRow}>
						<Text style={[styles.infoNum, { opacity: 0 }]}>1.</Text>
						<Text style={styles.infoText}>一口价=销售单价-（采购单价+资金成本单价+票据成本单价+运费成本单价+杂费平均单价）</Text>
					</View>
					<View style={styles.infoRow}>
						<Text style={styles.infoNum}>2.</Text>
						<Text style={styles.infoText}>计算商品单价时，授信、票据、运费、杂费成本单价不含其内</Text>
					</View>
				</View>
				<View style={styles.list}>
					{orderPriceItemList && orderPriceItemList.map((item, index) => {
						let { purchaseOrderItem } = item || {};
						return (<View key={index} style={styles.itemBox}>
							<View style={styles.itemUp}>
								<View style={styles.goods}>
									<Text style={styles.goodsName}>{item.goodsName}</Text>
									{item.priceType == "2" ? <Text style={styles.goodsType}>暂定价</Text> : <Text style={styles.goodsTypeActive}>一口价</Text>}
								</View>
								<View style={styles.typeBox}>
									<View style={styles.rowItem}>
										<Text style={styles.tdMore}></Text>
										<Text style={[styles.td, styles.th]}>采购（成本）</Text>
										<Text style={[styles.td, styles.th]}>销 售</Text>
									</View>
									<View style={styles.rowItem}>
										<Text style={styles.tdMore}>商品单价</Text>
										<Text style={[styles.td, styles.orange]}>+ ¥{purchaseOrderItem.barePrice || '-'}</Text>
										<Text style={[styles.td, styles.navy]}>+ ¥{item.barePrice || '-'}</Text>
									</View>
									<View style={styles.rowItem}>
										<Text style={styles.tdMore}>升贴水</Text>
										<Text style={[styles.td]}>¥{purchaseOrderItem.udPrice || '-'}</Text>
										<Text style={[styles.td]}>¥{item.udPrice || '-'}</Text>
									</View>
									<View style={styles.rowItem}>
										<Text style={styles.tdMore}>资金（授信）</Text>
										<Text style={[styles.td]}>¥{MethodUtil.countObj.add(item.fundCreditFee || 0, purchaseOrderItem.fundCreditFee || 0) || '-'}</Text>
										<Text style={[styles.td]}>-</Text>
									</View>
									<Text style={styles.rowItemText}>(*=[采加权平均价*{this.constProportion}%*本单款到天数/365]+[销加权平均价*{this.constProportion}%*授信天数/365])</Text>
									<View style={styles.rowItem}>
										<Text style={styles.tdMore}>资金（票据）</Text>
										<Text style={[styles.td]}>¥{item.fundVoucherFee || '-'}</Text>
										<Text style={[styles.td]}>-</Text>
									</View>
									<Text style={styles.rowItemText}>(*=加权平均单价*{this.constProportion}%*（销票据期限）/365）</Text>
									<View style={styles.rowItem}>
										<Text style={styles.tdMore}>运费</Text>
										<Text style={[styles.td]}>¥{logisticsFee || '-'}</Text>
										<Text style={[styles.td]}>-</Text>
									</View>
									<View style={styles.rowItem}>
										<Text style={styles.tdMore}>杂费</Text>
										<Text style={[styles.td]}>¥{averageOtherCost || '-'}</Text>
										<Text style={[styles.td]}>-</Text>
									</View>
								</View>
							</View>
							<View style={styles.itemDown}>
								<View style={styles.rowItem}>
									<Text style={[styles.tdMore, styles.goodsKeyActive]}>合同单价</Text>
									<Text style={[styles.td, styles.goodsKeyActive]}>¥{purchaseOrderItem.price || '-'}</Text>
									<Text style={[styles.td, styles.goodsKeyActive]}>¥{item.price || '-'}</Text>
								</View>
								<View style={[styles.other, styles.mm]}>
									<Text style={styles.goodsKey}>合计 {item.quantity} 吨，采总额  {(item.purchaseOrderItem && item.purchaseOrderItem.amount) || '-'}元，销总额 {item.amount || '-'}元</Text>
								</View>
								<View style={styles.other}>
									<Text style={styles.profit}>毛利：{item.grossProfit || '-'}元/吨，总毛利：{item.grossProfitAmt || '-'}元</Text>
								</View>
							</View>
						</View>)
					})}

				</View>
			</View>
		)
	}


	//敞口,长约,泉化,转单
	_renderSE = () => {
		let { data } = this.props || {};
		let { priceData, orderFlag } = data || {};
		let { orderPriceItemList, orderPriceInfo } = priceData || {};
		let { fundCreditInputFee, fundCreditFee, fundVoucherInputFee, fundVoucherFee, logisticsPrice, bidId } = orderPriceInfo || {};
		console.log('aaaaaaaaaaa', data)
		return (
			<View style={styles.list}>
				{
					orderPriceItemList && orderPriceItemList.map((item, index) => {
						return <View key={index} style={styles.itemBox}>
							<View style={styles.itemUp}>
								<View style={styles.goods}>
									<Text style={styles.goodsName}>{item.goodsName}</Text>
									{item.priceType == "2" ? <Text style={styles.goodsType}>暂定价</Text> : <Text style={styles.goodsTypeActive}>一口价</Text>}
								</View>
								<View style={styles.goodsInfo}>
									<View style={styles.goodsLi}>
										<Text style={styles.goodsKey}>商品单价</Text>
										<View style={styles.boxLeft}>
											<Text style={[styles.goodsValue, styles.fuhao]}>+</Text>
											<Text style={[styles.goodsValue, styles.fuhaoValue]}> ¥{item.barePrice || '-'}</Text>
										</View>
									</View>
									{
										orderFlag.tCode == 'QH' ? (<View>
											{/* <View style={styles.goodsLi}>
												<Text style={styles.goodsKey}>升贴水</Text>
												<View style={styles.boxLeft}>
													<Text style={[styles.goodsValue, styles.fuhao]}>+</Text>
													<Text style={[styles.goodsValue, styles.fuhaoValue]}> ¥{item.udPrice || '-'}</Text>
												</View>
											</View> */}
											{
												!bidId ? (<View style={styles.goodsLi}>
													<Text style={styles.goodsKey}>额外运费</Text>
													<View style={styles.boxLeft}>
														<Text style={[styles.goodsValue, styles.fuhao]}>+</Text>
														<Text style={[styles.goodsValue, styles.fuhaoValue]}> ¥{item.logisticsPrice || '-'}</Text>
													</View>
												</View>) : null
											}
										</View>) : null
									}
									{
										item.rebatePrice ? <View style={styles.goodsLi}>
											<Text style={styles.goodsKey}>客户优惠</Text>
											<View style={styles.boxLeft}>
												<Text style={[styles.goodsValue, styles.fuhao]}>-</Text>
												<Text style={[styles.goodsValue, styles.fuhaoValue]}> ¥{item.rebatePrice || '-'}</Text>
											</View>
										</View> : null
									}
									{
										bidId ? (<View>
											{
												logisticsPrice ? (
													<View style={styles.goodsLi}>
														<Text style={styles.goodsKey}>额外运费</Text>
														<View style={styles.boxLeft}>
															<Text style={[styles.goodsValue, styles.fuhao]}>+</Text>
															<Text style={[styles.goodsValue, styles.fuhaoValue]}> ¥{logisticsPrice || '-'}</Text>
														</View>
													</View>
												) : null
											}
											{orderFlag.orderType == "S" ? (<View style={styles.goodsLi}>
												<Text style={styles.goodsKey}>资金成本(授信)</Text>
												<View style={styles.boxLeft}>
													<Text style={[styles.goodsValue, styles.fuhao]}>+</Text>
													<Text style={[styles.goodsValue, styles.fuhaoValue]}> ¥{((bidId && orderFlag.orderType == 'S') ? fundCreditInputFee : fundCreditFee) || '-'}</Text>
												</View>
											</View>) : null}
											{
												orderFlag.orderType == "S" ? (<View style={styles.goodsLi}>
													<Text style={styles.goodsKey}>资金成本(票据)</Text>
													<View style={styles.boxLeft}>
														<Text style={[styles.goodsValue, styles.fuhao]}>+</Text>
														<Text style={[styles.goodsValue, styles.fuhaoValue]}> ¥{((bidId && orderFlag.orderType == 'S') ? fundVoucherInputFee : fundVoucherFee) || '-'}</Text>
													</View>
												</View>) : null
											}
										</View>) : null
									}
								</View>
							</View>
							<View style={[styles.itemDown]}>
								<View style={styles.goodsLi}>
									<Text style={[styles.goodsKeyActive]}>合同单价</Text>
									<View style={styles.boxLeft}>
										<Text style={[styles.goodsValue, styles.fuhao, { opacity: 0 }]}>+</Text>
										<Text style={[styles.goodsValueActive, styles.fuhaoValue]}>¥{item.price || '-'}</Text>
									</View>
								</View>
								<View style={[styles.other, styles.mm]}>
									<Text style={styles.goodsKey}>合计：{item.quantity || '-'}吨，合同{item.amount || '-'}元</Text>
								</View>
								<View style={styles.other}>
									<TouchableOpacity style={styles.outs} onPress={() => { this._alertFn() }}>
										<Text style={styles.goodsKey}>落袋{MethodUtil.countObj.multiply(item.pocketPrice, item.quantity) || '-'}元</Text>
										<Image style={styles.tipText} source={require('../../../imgs/global/query.png')} />
									</TouchableOpacity>
								</View>
							</View>
							{item.priceType == "2" ?
								<View style={styles.itemUp2}>
									<View style={styles.rowItem}>
										<Text style={styles.tdMore}>折扣综合计算(合同升贴水)</Text>
										<View style={styles.boxLeft}>
											<Text style={[styles.goodsValueActive2, styles.fuhao]}>+</Text>
											<Text style={[styles.goodsValueActive, styles.fuhaoValue]}>¥{Utils.isEmpty(item.bidUdPrice) ? '-' : item.bidUdPrice}</Text>
										</View>
									</View>
									{ // 转单
										bidId ? <View style={styles.udPriceBox}>
											<View style={styles.udPriceItem}>
												<Text style={styles.udPriceKey}>升贴水:</Text>
												<Text style={[styles.udPriceValue]}>¥{Utils.isEmpty(item.bareUdPrice) ? '-' : item.bareUdPrice}</Text>
											</View>
											<View style={styles.udPriceItem}>
												<Text style={styles.udPriceKey}>额外运费:</Text>
												<Text style={[styles.udPriceValue]}>¥{Utils.isEmpty(logisticsPrice) ? '-' : logisticsPrice}</Text>
											</View>
											{
												orderFlag.orderType == "S" ? <View style={styles.udPriceItem}>
													<Text style={styles.udPriceKey}>资金(授信):</Text>
													<Text style={[styles.udPriceValue]}>¥{((orderFlag.orderType == 'S') ? fundCreditInputFee : fundCreditFee) || '-'}</Text>
												</View> : null
											}
											{
												orderFlag.orderType == "S" ? <View style={styles.udPriceItem}>
													<Text style={styles.udPriceKey}>资金(票据):</Text>
													<Text style={[styles.udPriceValue]}>¥{((orderFlag.orderType == 'S') ? fundVoucherInputFee : fundVoucherFee) || '-'}</Text>
												</View> : null
											}
											{
												<View style={styles.udPriceItem}>
													<Text style={styles.udPriceKey}>客户优惠:</Text>
													<Text style={[styles.udPriceValue]}>{!Utils.isEmpty(item.rebatePrice) && item.rebatePrice != 0 ? `- ¥${item.rebatePrice}` : "-"}</Text>
												</View>
											}
										</View> : null
									}
								</View>
								: null}
						</View>
					})
				}

			</View>
		)
	}

	//合同单价-计算 (加)
	_sum = (...agrs) => {
		let result = 0;
		agrs && agrs.forEach((item) => {
			result = MethodUtil.countObj.add(result, item)
		})
		return result;
	}

	//合同价-计算 (乘)
	_sumAll = (...agrs) => {
		let result = agrs[0];
		agrs && agrs.forEach((item, index) => {
			if (index > 0) {
				result = MethodUtil.countObj.multiply(result, item)
			}
		})
		return result;
	}


	render() {
		let { data, closeFn, title } = this.props || {};
		let { orderFlag, relation, priceData } = data || {};
		let { orderPriceItemList } = priceData || {};
		return (
			<View style={styles.details}>
				<View style={styles.headBox}>
					<Image source={require('../../../imgs/close.png')} style={{ opacity: 0 }} />
					<Text style={styles.title}>{title || '价格计算明细'}</Text>
					<TouchableOpacity style={styles.closeBox} onPress={() => { console.log('closeFn', closeFn); closeFn && closeFn() }}>
						<Image source={require('../../../imgs/close.png')} style={styles.close} />
					</TouchableOpacity>
				</View>
				<View style={{ flex: 1 }}>
					<ScrollView style={{ flex: 1 }}>
						<View>
							{orderPriceItemList && orderPriceItemList.length ? (relation ? this._relation() : (orderFlag.tCode === 'C' ? this._renderC() : this._renderSE())) : <View style={styles.empty}><PageStatusIndex status={'empty'} emptyText="暂无商品" /></View>}
						</View>
					</ScrollView>
				</View>

			</View>
		)
	}
}

const styles = StyleSheet.create({
	udPriceKey: {
		fontSize: 10 * scale,
		textAlign: 'right',
		marginRight: 8 * scale,
		opacity: .8
	},
	udPriceValue: {
		minWidth: 50 * scale,
		fontSize: 10 * scale,
		opacity: .8
	},
	udPriceItem: {
		flexDirection: 'row',
		justifyContent: 'flex-end',
		alignItems: 'center',
		paddingVertical: 5 * scale
	},
	details: {
		paddingLeft: 10 * scale,
		paddingRight: 10 * scale,
		flex: 1
	},
	headBox: {
		height: 30 * scale,
		flexDirection: 'row',
		justifyContent: 'space-between',
		alignItems: 'center',
		marginTop: 15 * scale,
		marginBottom: 20 * scale
	},
	title: {
		fontSize: 18 * scale,
		fontWeight: "bold"
	},
	closeBox: {
		padding: 5 * scale,
		marginRight: 15 * scale
	},
	close: {
		tintColor: style.color.themeColor,
		height: 16 * scale,
		width: 16 * scale,
	},
	itemBox: {
		marginBottom: 30 * scale,
	},
	goods: {
		flexDirection: 'row',
		paddingBottom: 15 * scale,

	},
	goodsName: {
		fontSize: 14 * scale,
		color: '#000',
		fontWeight: 'bold'
	},
	goodsType: {
		marginLeft: 8 * scale,
		fontSize: 10 * scale,
		color: style.color.orange,
		paddingTop: 3 * scale,
		paddingBottom: 3 * scale,
		paddingLeft: 5 * scale,
		paddingRight: 5 * scale,
		backgroundColor: 'rgba(250, 100, 0, .1)'
	},
	goodsTypeActive: {
		marginLeft: 8 * scale,
		fontSize: 10 * scale,
		color: style.color.skyBlue,
		paddingTop: 3 * scale,
		paddingBottom: 3 * scale,
		paddingLeft: 5 * scale,
		paddingRight: 5 * scale,
		backgroundColor: 'rgba(133, 192, 236, .1)'
	},
	itemUp: {
		borderBottomWidth: 1 / PixelRatio.get(),
		borderStyle: 'solid',
		borderBottomColor: style.color.border,
		paddingLeft: 10 * scale,
		paddingRight: 20 * scale
	},
	itemUp2: {
		marginVertical: 20 * scale,
		borderTopWidth: 1 / PixelRatio.get(),
		borderStyle: 'solid',
		borderTopColor: style.color.border,
		paddingLeft: 10 * scale,
		paddingRight: 20 * scale
	},
	itemDown: {
		paddingLeft: 10 * scale,
		paddingRight: 20 * scale
	},
	goodsLi: {
		flexDirection: 'row',
		justifyContent: "space-between",
		alignItems: 'center',
		paddingTop: 15 * scale,
		paddingBottom: 15 * scale,
	},
	goodsKey: {
		fontSize: 12 * scale,
	},
	goodsValue: {
		fontSize: 12 * scale,
		color: style.color.orange,
	},
	goodsKeyActive: {
		fontSize: 12 * scale,
		fontWeight: 'bold'
	},
	goodsValueActive: {
		fontSize: 12 * scale,
		fontWeight: 'bold'
	},
	goodsValueActive2: {
		fontSize: 12 * scale,
		marginRight: 5 * scale
	},
	other: {
		flexDirection: 'row',
		justifyContent: 'flex-end',
		alignItems: 'center',
		position: 'relative',
	},
	mm: {
		marginTop: 5 * scale,
		marginBottom: 5 * scale
	},
	tipText: {
		height: 15 * scale,
		width: 15 * scale,
		marginLeft: 5 * scale
		//position: 'absolute',
		//top: 0 * scale,
		//right: -20 * scale
	},
	textRow: {
		marginBottom: 20 * scale
	},
	textRowText: {
		fontSize: 13 * scale,
		lineHeight: 16 * scale
	},
	textRowTextP: {
		paddingLeft: 13 * scale,
		paddingTop: 5 * scale
	},
	accountSelect: {
		flexDirection: 'row',
		alignItems: 'center',
		justifyContent: 'flex-start',
		marginBottom: 12 * scale
	},
	infoBox: {
		paddingLeft: '8%',
		paddingRight: '8%',
		marginBottom: 30 * scale,
	},
	infoRow: {
		flexDirection: 'row'
	},
	infoNum: {
		width: 10 * scale,
		fontSize: 10 * scale,
		lineHeight: 14 * scale
	},
	infoText: { fontSize: 10 * scale, lineHeight: 14 * scale },
	typeBox: {
		paddingBottom: 10 * scale
	},
	rowItem: {
		flexDirection: 'row',
		paddingTop: 10 * scale,
		paddingBottom: 10 * scale
	},
	tdMore: {
		flex: 4,
		fontSize: 12 * scale
	},
	td: {
		flex: 3,
		fontSize: 12 * scale
	},
	th: {
		fontSize: 12 * scale,
		textAlign: 'center'
	},
	orange: {
		color: style.color.orange
	},
	navy: {
		color: style.color.navy
	},
	rowItemText: {
		opacity: .5,
		fontSize: 10 * scale,
		marginTop: -5 * scale,
		paddingBottom: 8 * scale
	},
	profit: {
		fontSize: 10 * scale,
		color: '#F80303'
	},
	boxLeft: {
		width: 75 * scale,
		flexDirection: 'row',
		alignItems: 'center'
	},
	fuhao: {
		width: 10 * scale,
		fontSize: 14 * scale,
	},
	fuhaoValue: {
		width: 65 * scale,
	},
	rGoodsName: {
		fontSize: 13 * scale,
		fontWeight: 'bold',
		//marginTop: 15 * scale,
		//marginBottom: 15 * scale
	},
	rTipText: {
		height: 15 * scale,
		width: 15 * scale,
	},
	rBox: {
		backgroundColor: '#F4F7FE',
		borderRadius: 8 * scale,
		paddingTop: 20 * scale,
		paddingBottom: 20 * scale,
		marginTop: 15 * scale
	},
	rRow: {
		flexDirection: 'row',
		flex: 1,
		paddingTop: 8 * scale,
		paddingBottom: 8 * scale
	},
	rFlex4: {
		flex: 4,
	},
	rFlex3: {
		flex: 3,
	},
	rFlex2: {
		flex: 2,
	},
	rFlex7: {
		flex: 7
	},
	rKey: {
		fontSize: 12 * scale,
		color: '#999'
	},
	rValue: {
		fontSize: 12 * scale,
	},
	rBold: {
		fontWeight: 'bold',
		color: '#000'
	},
	rPadding: {
		paddingLeft: 15 * scale,
		paddingRight: 15 * scale
	},
	xian: {
		borderBottomWidth: 1 / PixelRatio.get(),
		borderStyle: 'solid',
		borderBottomColor: '#979797',
	},
	rRight: {
		textAlign: 'right'
	},
	rRed: {
		color: '#F20505'
	},
	fontSize10: {
		fontSize: 10 * scale,
	},
	rRowActive: {
		flexDirection: 'row'
	},
	empty: { height: '100%', alignItems: 'center' },
	outs: { flexDirection: 'row', flex: 1, justifyContent: 'flex-end', position: 'relative', left: 20 * scale },
	udPriceBox: {
		backgroundColor: style.color.bgGray,
		paddingVertical: 10 * scale,
		paddingHorizontal: 5 * scale,
		borderRadius: 5 * scale
	}
})